//ConfigModel config | Object	| NonNull
//List<CommonModel> bannerList | Array	|	NonNull
//List<CommonModel> localNavList | Array	| NonNull
//GridNavModel gridNav | Object	|	NonNull
//List<CommonModel> subNavList | Array	|	NonNull
//SalesBoxModel salesBox | Object	|	NonNull

import 'package:flutterxc/module/config_module.dart';
import 'package:flutterxc/module/sales_box_module.dart';

import 'common_module.dart';
import 'gridnav_module.dart';

class HomeModule {
  final ConfigModel config;
  final List<CommonModel> bannerList;
  final List<CommonModel> localNavList;
  final List<CommonModel> subNavList;
  final GridNavModel gridNav;
  final SalesBoxModel salesBox;

  HomeModule(
      {this.subNavList,
      this.gridNav,
      this.config,
      this.bannerList,
      this.localNavList,
      this.salesBox});

  factory HomeModule.fromJson(Map<String, dynamic> json) {

    var localNavListJson = json['localNavList'] as List;
    List<CommonModel> localNavList =
        localNavListJson.map((i) => CommonModel.fromJson(i)).toList();

    var bannerListJson = json['bannerList'] as List;
    List<CommonModel> bannerList =
    bannerListJson.map((i) => CommonModel.fromJson(i)).toList();

    var subNavListJson = json['subNavList'] as List;
    List<CommonModel> subNavList =
        subNavListJson.map((i) => CommonModel.fromJson(i)).toList();
    return HomeModule(
        bannerList: bannerList,
        localNavList: localNavList,
        subNavList: subNavList,
        config: ConfigModel.fromJson(json['config']),
        gridNav: GridNavModel.fromJson(json['gridNav']),
        salesBox: SalesBoxModel.fromJson(json['salesBox']));
  }
}
